<template>
  <view>
    <uni-popup ref="privacyPopup" type="center" :safe-area="false">
      <view class="privacy-content">
        <view>感谢您使用本产品，您使用本产品前，请先仔细阅读并同意</view>
        <view> <text @click="openPrivacyContract" style="color:#576b95 ;">{{privacyContractName}}</text></view>
        <view style="display: flex;margin-top: 40rpx;">
          <button size="small" @click="handleTap(false)" style="border-radius: 100px;">取消</button>
          <button size="small" id="agree-btn" type="default" open-type="agreePrivacyAuthorization"
            @agreeprivacyauthorization="handleTap(true)">同意</button>
        </view>

      </view>

    </uni-popup>
  </view>
</template>

<script>
  export default {
    name: "privacy-popup",
    props: {
      privacyContractName: {
        type: String
      }
    },
    data() {
      return {

      };
    },
    methods: {
      openPrivacyContract() {
        wx.openPrivacyContract()
      },
      handleTap(result) {
        console.log(result)
        this.$refs.privacyPopup.close()
      }
    }

  }
</script>

<style scoped>
  .privacy-content {
    margin: 30rpx;
    padding: 20rpx;
    height: 300rpx;
    background: #fff;
    border-radius: 20rpx;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }

  .privacy-content button {
    width: 40%;
  }
</style>